App({
	onLaunch() {
		wx.getSystemInfo({
			success: res => {
				if (res.model.search('iPhone X') != -1 || res.model.search('iPhone XS') != -1 || res
					.model.search('iPhone XS Max') != -1 || res.model.search('iPhone XR') != -1 ||
					res.model.search('unknown') != -1) {
					this.globalData.model.phone = 'iPhone X'
				} else if (res.model.search('iPhone') != -1) {
					this.globalData.model.phone = 'iPhone'
				} else {
					this.globalData.model.phone = res.model
        }
        var bottomHeight = res.screenHeight - res.safeArea.bottom;
        this.globalData.model.bottomHeight = bottomHeight > 0 ? bottomHeight : 13;
			}
		})
		const res = wx.getMenuButtonBoundingClientRect();
		this.globalData.model.topHeight = res.height;
    this.globalData.model.topMargin = res.top;
	},
	// 判断是否为手机号
	isPhone(pone) {
		var myreg = /^[1][3-9][0-9]+\d{8}$/;
		// var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1})|(17[0-9]{1}))+\d{8})$/;
		if (!myreg.test(pone)) {
			return false;
		} else {
			return true;
		}
	},
	globalData: {
		userInfo: null,
		model: {
			phone: '',
			topHeight: '',
      topMargin: '',
      bottomHeight: 0
    },
	}
})
